Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix const value root font size loading #2

Open
wants to merge 3 commits into
base: render
Choose a base branch
from

Conversation

travisbader
Copy link

@travisbader travisbader commented Jan 10, 2025

Fixes these errors

System.InvalidCastException: Unable to cast object of type 'AngleSharp.Css.Values.Constant`1[AngleSharp.Css.Values.Length]' to type 'System.Nullable`1[AngleSharp.Css.Values.Length]'.

I also implemented Ex units and improved logging for unsupported units while i was in here.

CON-1021

@@ -287,6 +287,10 @@ public Double ToPixel(IRenderDimensions renderDimensions)
return _value * 96.0 / 72.0;
case Unit.Cm: // 1 cm = 50/127 in
return _value * 50.0 * 96.0 / 127.0;
case Unit.Ex:
CheckForValidRenderDimensionsForFont(renderDimensions);
// 1ex is the x-height of the font, or half of 1em.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't true. It depends on the font. If there are places where we can use an approximate value, can we do that calculation there?
Screenshot 2025-01-13 at 11 24 57 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants